﻿@page "/Polar/Coordinates"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore.SkiaSharpView
@using LiveChartsCore
@using LiveChartsCore.Defaults

<PolarChart
	Series="Series"
	AngleAxes="AngleAxes">
</PolarChart>

@code {
    private ISeries[] Series { get; set; }
    private PolarAxis[] AngleAxes { get; set; }

    protected override void OnInitialized()
    {
        var values = new ObservablePolarPoint[]
        {
            new(0, 10),
            new(45, 15),
            new(90, 20),
            new(135, 25),
            new(180, 30),
            new(225, 35),
            new(270, 40),
            new(315, 45),
            new(360, 50)
        };

        Series = new ISeries[]
        {
            new PolarLineSeries<ObservablePolarPoint>
            {
                Values = values,
                IsClosed = true,
                Fill = null
            }
        };

        AngleAxes = new PolarAxis[]
        {
            new() {
                MinLimit = 0,
                MaxLimit = 360,
                Labeler = angle => $"{angle}°",
                ForceStepToMin = true,
                MinStep = 30
            }
        };
    }
}
